<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html="en">
<head>
	<base href="<%=basePath%>">
	<meta charset="UTF-8">
	<link rel="stylesheet" href="front/css/normal.css">
    <link rel="stylesheet" href="front/css/addBox.css">
</head>
<body>
	<p class="addSlide-title">添加用户<span>×</span></p>
	<form action="employee/${msg }.do" name="Form" id="Form" method="post">
		<ul class="addList">
		  	<li>
		  		<span>姓名:</span>
		  		<input type="text" name="base_name" id="base_name" maxlength="32" placeholder="这里输入" title=""/>
		  	</li>
		  	<li>
		  		<span>性别:</span>
		  		<input name="base_sex" id="base_sex1" type="radio" checked="checked" value="0">男
				<input name="base_sex" id="base_sex2" type="radio" value="1">女
		  	</li>
		  	<li>
	  			<span>请选择部门:</span>
		  		<select class="chzn-select" name="department_id" id="department_id" style="vertical-align:top;">
					<option value="">请选择部门:</option>
					<c:forEach items="${deptList}" var="department">
					<option value="${department.departmentId }"
						<c:if test="${department.departmentId == pd.department_id }">selected</c:if>
					>${department.departmentName }
					</option>
				</c:forEach>
				</select>
		  	</li>
		  	<li>
		  		<span>联系电话:</span>
		  		<input type="text" name="base_phone" id="base_phone" maxlength="32" placeholder="这里输入" title=""/>
		  	</li>
		</ul>
		<p>
			<input type="button" onclick="cancel()" value="取消保存" class='cancelSave'>
			<input type="button" onclick="save();" value="确认保存" class='confirmSave'>
		</p>
	</form>
</body>
<!-- 引入 -->
<script src="front/js/jquery-2.0.3.min.js"></script>
<script src="front/js/jquery.tips.js"></script>
<script src="front/js/index.js"></script>
<script type="text/javascript">
	function cancel(){
		$('#zhongxin', parent.document).hide();
	}
	
	//保存
	function save(){
		if($("#base_name").val()==""){
			$("#base_name").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#base_name").focus();
			return false;
		}
		if($("#base_sex").val()==""){
			$("#base_sex").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#base_sex").focus();
			return false;
		}
		if($("#base_identity").val()==""){
			$("#base_identity").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#base_identity").focus();
			return false;
		}
		if($("#base_birthday").val()==""){
			$("#base_birthday").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#base_birthday").focus();
			return false;
		}
		if($("#base_nationality").val()==""){
			$("#base_nationality").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#base_nationality").focus();
			return false;
		}
		if($("#base_native_place").val()==""){
			$("#base_native_place").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#base_native_place").focus();
			return false;
		}
		if($("#base_politics").val()==""){
			$("#base_politics").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#base_politics").focus();
			return false;
		}
		if($("#base_phone").val()==""){
			$("#base_phone").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#base_phone").focus();
			return false;
		}
		if($("#base_marriage").val()==""){
			$("#base_marriage").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#base_marriage").focus();
			return false;
		}
		if($("#base_record_number").val()==""){
			$("#base_record_number").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#base_record_number").focus();
			return false;
		}
		if($("#base_record_position").val()==""){
			$("#base_record_position").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#base_record_position").focus();
			return false;
		}
		if($("#base_email").val()==""){
			$("#base_email").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#base_email").focus();
			return false;
		}
		if($("#base_address").val()==""){
			$("#base_address").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#base_address").focus();
			return false;
		}
		if($("#base_education_background").val()==""){
			$("#base_education_background").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#base_education_background").focus();
			return false;
		}
		if($("#base_graduation").val()==""){
			$("#base_graduation").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#base_graduation").focus();
			return false;
		}
		if($("#base_major").val()==""){
			$("#base_major").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#base_major").focus();
			return false;
		}
		if($("#base_employee_type").val()==""){
			$("#base_employee_type").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#base_employee_type").focus();
			return false;
		}
		if($("#base_photo").val()==""){
			$("#base_photo").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#base_photo").focus();
			return false;
		}
		if($("#user_id").val()==""){
			$("#user_id").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#user_id").focus();
			return false;
		}
		if($("#company_id").val()==""){
			$("#company_id").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#company_id").focus();
			return false;
		}
		if($("#filiale_id").val()==""){
			$("#filiale_id").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#filiale_id").focus();
			return false;
		}
		if($("#base_createtime").val()==""){
			$("#base_createtime").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#base_createtime").focus();
			return false;
		}
		if($("#base_updatetime").val()==""){
			$("#base_updatetime").tips({
				side:3,
	            msg:'请输入',
	            bg:'#AE81FF',
	            time:2
	        });
			$("#base_updatetime").focus();
			return false;
		}
		
		$.ajax({
			type: "POST",
			url: $("#Form").attr("action"),
	    	data: $("#Form").serialize(),
			dataType:'json',
			cache: false,
			success: function(data){
				if(data.status){
					document.getElementById('zhongxin').style.display = 'none';
					top.Dialog.close();
				}else{
					alert(data.msg);
				}

			}
		});
	}
	$(function() {
		//单选框
		$(".chzn-select").chosen(); 
		$(".chzn-select-deselect").chosen({allow_single_deselect:true}); 
		
		$('.date-picker').datepicker(
				{
	                autoclose:true,
	                format: "yyyy-mm-dd",
	                language: 'cn',
	                clearBtn:true,
	                todayHighlight: true
	            }
			);
		
		//日期框
		$(".form_datetime").datetimepicker({format: 'yyyy-mm-dd',autoclose: true});
		
	});
</script>
</html>